Skip to content

Conversation

D4ve-R
Copy link
Contributor

@D4ve-R D4ve-R commented Nov 22, 2024

This PR adds handling of the disabled attribute to links.

Problem:

Currently clicking on Links where the disabled attribute is set, triggers a request.

<!-- unexpected request on click -->
<Link href="#" disabled>Disabled</Link>

Solution:

Add a disabled prop to the Link Component and stop click & prefetch events, when attribute exists or is set to true

Notes:

The changes are currently only implemented in @interia/vue.
If accepted, I will implement it in @interia/react & @interia/svelte too.

@D4ve-R
Copy link
Contributor Author

D4ve-R commented Nov 22, 2024

fixes #1620

<Link :disabled="disabled">
<!-- instead of -->
<Link :as="disabled ? 'button' : 'a'" :disabled="disabled">

@pascalbaljet
Copy link
Member

fixes #1620

<Link :disabled="disabled">
<!-- instead of -->
<Link :as="disabled ? 'button' : 'a'" :disabled="disabled">

Thanks for this! I think it's a good addition even though the a tag does not natively support disabled. But since it also supports other non-native features like prefetching in v2, I think it's no problem.

Could you please implement it in the other packages as well? Thanks!

@pascalbaljet pascalbaljet added the needs more info/work Needs more info from the author or additional work to get merged label Jun 17, 2025
@pascalbaljet
Copy link
Member

I'm closing this pull request due to lack of activity. If you're still working on this or have updates to share, feel free to open a new PR. We'd be happy to take another look. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs more info/work Needs more info from the author or additional work to get merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants